package com.zeny.express.framework.shared.serializer;

/**
 * 序列化/反序列化
 * 
 * @author zhuwei
 * @date 2013年9月4日 下午3:52:00
 */
public interface Serializer<T> {

	/**
	 * Serialize the given object to binary data.
	 * 
	 * @param t
	 *            object to serialize
	 * @return the equivalent binary data
	 */
	byte[] serialize(T t);

	/**
	 * Deserialize an object from the given binary data.
	 * 
	 * @param bytes
	 *            object binary representation
	 * @return the equivalent object instance
	 */
	T deserialize(byte[] bytes);

}